package com.ybzl;

import org.apache.commons.lang3.ArrayUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.util.ObjectUtils;

import java.util.Arrays;

/**
 * 启动程序
 *
 * @author dtf
 * <p>
 * DataSourceAutoConfiguration >  DruidDataSourceAutoConfigure > DynamicDataSourceAutoConfiguration
 */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class DigitalApp {
    public static void main(String[] args) {
        if (ObjectUtils.isEmpty(System.getProperty("server.home"))){
            System.setProperty("server.home",".");
        }
        if (Arrays.stream(args).noneMatch(str -> str.contains("--mpw.key"))) {
            String[] aa = ArrayUtils.insert(args.length, args, "--mpw.key=65001cdce347030d");
            SpringApplication.run(DigitalApp.class, aa);
        }else {
            SpringApplication.run(DigitalApp.class, args);
        }
    }
}
